public class Test {
    public static void dfs(int[] arr,int n){
        if(n==arr.length){
            return;
        }
        System.out.print(arr[n]+" ");
        dfs(arr,n+1);

    }
    public static void fun(String s1,int n){
        if(n==s1.length()){
            return;
        }
        System.out.print(s1.charAt(n)+" ");
        fun(s1,n+1);
    }
    public static int fun1(int n){
        if(n==1){
            return 1;
        }
        return  n*fun1(n-1);
    }
    public static int fun2(int a,int b){
        if(a==b){
            return a;
        }
        if(a>b){
            return  fun2(a-b,b);
        }
        else{
            return  fun2(b-a,a);
        }
    }
    public static void fun3(int n){
        if(n==0){
            return;
        }
        System.out.print(n%10);
        fun3(n/10);
    }
    public static void fun4(int n,int x){
        if(x==0){
            return;
        }
        System.out.print((int)n/(int)Math.pow(10,x-1));
        fun4((int)(n-(int)n/(int)Math.pow(10,x-1)*Math.pow(10,x-1)),x-1);
    }
    public static void main(String[] args) {
        int[] arr=new int[]{1,2,3,4,5,6,7,8,9};

        dfs(arr,0);
        System.out.println();
        String s1="123456";
        fun(s1,0);
        int c=fun1(5);
        System.out.println(c);
        int a=fun2(18,9);
        System.out.println(a);

        fun3(12345);
        System.out.println();
        // fun4((int)(n-n/Math.pow(10,x-1)*Math.pow(10,x-1)),x-1);
        int n=(int)(476-(int)476/(int)Math.pow(10,2)*Math.pow(10,2));
        System.out.println(n);
        fun4(12345645,8);


    }

}